<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String shebeitype = request.getParameter("shebeitype");
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>设备维保</title>
		<meta http-equiv="X-UA-Compatible" content="IE=7" />
		<%@ include file="../jslib/jquerylib.jsp" %>
	    <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
        <link href="<%=request.getContextPath() %>/web/style/layout.css" type="text/css" rel="stylesheet"/>
        <link rel="stylesheet" href="<%=request.getContextPath() %>/jslib/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
        <script type="text/javascript" src="<%=request.getContextPath() %>/jslib/ztree/jquery.ztree.core-3.4.js"></script>
		<script type="text/javascript">
            var selectId = "" ;
            var actionUrl='';
            $(document).ready(function(){
                $("#fromTable").jqGrid({
                   url:'<%=request.getContextPath()%>/shebeiweibaoAction!queryShebeiweibaoList.action',
              //	url:actionUrl,
                    datatype: "json",
                    height: 280,
                    autowidth: true, 
                    colNames:['ID','设备id','设备名称','维保项目','维保基准','测量变量方法','操作要点','设备编号','规格型号','部门id','部门名称','序号','保养级别','工具','劳保','保养周期','上次保养时间','提醒天数','修改描述','更改原因'],
                    colModel:[
                        {name:'ID',index:'ID', width:60, key:true,hidden:true,hidedlg:true}, 
                        		{name:'SHEBEIID',index:'SHEBEIID', width:100,hidden:true},
                        		{name:'SHEBEINAME',index:'SHEBEINAME', width:100},
                        		{name:'WEIBAOXIANGMU',index:'WEIBAOXIANGMU', width:100,hidden:true},	
								{name:'WEIBAOJIZHUN',index:'WEIBAOJIZHUN', width:100},								
								{name:'CELIANGBIANLIANG',index:'CELIANGBIANLIANG', width:100},
								{name:'CAOZUOYAODIAN',index:'CAOZUOYAODIAN', width:110},
								{name:'SHEBEINO',index:'SHEBEINO', width:110,hidden:true},
								{name:'GUIGEXINGHAO',index:'GUIGEXINGHAO', width:110},
								{name:'BUMENID',index:'BUMENID', width:50,hidden:true},
								{name:'BUMENNAME',index:'BUMENNAME', width:50},
								{name:'XUHAO',index:'XUHAO', width:110,hidden:true},
								{name:'BAOYANGJIBIE',index:'BAOYANGJIBIE', width:110},
								{name:'GONGJU',index:'GONGJU', width:110},
								{name:'LAOBAO',index:'LAOBAO', width:50},
								{name:'BAOYANGZHOUQI',index:'BAOYANGZHOUQI', width:80},
								{name:'SHANGCIWEIBAOTIME',index:'SHANGCIWEIBAOTIME',width:110},
								{name:'TIXINGTIANSHU',index:'TIXINGTIANSHU', width:110},
								{name:'XIUGAIMIAOSHU',index:'XIUGAIMIAOSHU', width:50,hidden:true},
								{name:'BIANGENGYUANYIN',index:'BIANGENGYUANYIN', width:80,hidden:true} 
                    ],      
                    shrinkToFit:false,
                    sortname:'ID',
                    sortorder:'desc',
                    viewrecords:true,
					multiselect: true, // 是否显示复选框
					gridview: true,  //提升速度
					rownumbers: true,
					rowNum:100,
					rowNum:<%=session.getAttribute("SYS_PAGECOUNT")%>,
					ondblClickRow: function(rowid){
			            var row = $("#fromTable").jqGrid('getRowData',rowid);
			            $("#fromTable").jqGrid('delRowData',rowid);
			           var result = "{'id':'"+row.ID+"','shebeiid':'"+row.SHEBEIID+"','shebeiname':'"+row.SHEBEINAME+"','weibaoxiangmu':'"+row.WEIBAOXIANGMU+"','weibaojizhun':'"+row.WEIBAOJIZHUN+"','celiangbianliang':'"+row.CELIANGBIANLIANG+"','caozuoyaodian':'"+row.CAOZUOYAODIAN+"','tixingtianshu':'"+
row.TIXINGTIANSHU+"','gugexinghao':'"+row.GUIGEXINGHAO+"','shebeino':'"+row.SHEBEINO+"','bumenid':'"+row.BUMENID+"','bumenname':'"+row.BUMENNAME+
"','xuhao':'"+row.XUHAO+"','baoyangjibie':'"+row.BAOYANGJIBIE+"','gongju':'"+row.GONGJU+"','laobao':'"+row.LAOBAO+"','baoyangzhouqi':'"+
row.BAOYANGZHOUQI+"','shangciweibaotime':'"+row.SHANGCIWEIBAOTIME+"'}";
						
				       		window.returnValue = result;
			       			window.close();	
			        },
					rowList:[10,20,30,40,50],
					toolbar: [true,"top"],
					jsonReader: {
						root:"rows",		// 数据行（默认为：rows）
						page: "page",  	// 当前页
						total: "total",  // 总页数
						records: "records",  // 总记录数
						repeatitems : false		// 设置成false，在后台设置值的时候，可以乱序。且并非每个值都得设
					},
					prmNames:{rows:"rows",page:"page",sort:"ID",order:"sord",search:"search"},
					pager:"#fromPager",
					caption: "维保列表"
                });
                 jQuery("#fromTable").jqGrid('navGrid','#fromPager',{add:false,edit:false,del:false,search:false,refresh:false});
                 
         //确定按钮
        $("#entry").click(function(){
	    	var rowid = $("#fromTable").getGridParam("selrow");
	    	var r = $("#fromTable").getGridParam("selarrrow")+"";
			if (!rowid) {   // (1)  
			    alert("请先选择记录!");  
			    return false;  
			} 
			if(r.indexOf(",")!=-1){
				  alert("只能选择一条记录!");  
			        return false; 
			 }
			var row = $("#fromTable").jqGrid('getRowData',rowid);
	    	  var result = "{'id':'"+row.ID+"','shebeiid':'"+row.SHEBEIID+"','shebeiname':'"+row.SHEBEINAME+"','weibaoxiangmu':'"+row.WEIBAOXIANGMU+"','weibaojizhun':'"+row.WEIBAOJIZHUN+"','celiangbianliang':'"+row.CELIANGBIANLIANG+"','caozuoyaodian':'"+row.CAOZUOYAODIAN+"','tixingtianshu':'"+
row.TIXINGTIANSHU+"','gugexinghao':'"+row.GUIGEXINGHAO+"','shebeino':'"+row.SHEBEINO+"','bumenid':'"+row.BUMENID+"','bumenname':'"+row.BUMENNAME+
"','xuhao':'"+row.XUHAO+"','baoyangjibie':'"+row.BAOYANGJIBIE+"','gongju':'"+row.GONGJU+"','laobao':'"+row.LAOBAO+"','baoyangzhouqi':'"+
row.BAOYANGZHOUQI+"','shangciweibaotime':'"+row.SHANGCIWEIBAOTIME+"'}";
	   	    window.returnValue = result;
	        window.close();
    });
       /**
	     * 取消
	     */
	    $("#center").click(function(){
	        window.close();
	    });
        });
       
	     
           // 调用子集方式2	 
	 function callStateM2(json){
			 $("#bumen").empty();
				var html = '<option value="">--请选择--</option>';
				  $('#bumen').append(html);
				if(json!=''){
				$.each(json,function(entryindex,entry){
					html = '<option value="'+entry['id']+'">' + entry['zuzhi'] + '</option>';
					$('#bumen').append(html);
				});
			}
	}
    </script>

	</head>


	<body>
		<form action="" id="form1" method="post">
			<table style="width: 100%;" class="tableCont">
				<tr>
					<td colspan="4">
						<table id="fromTable"></table>
						<div id="fromPager"></div>
					</td>
				</tr>
			</table>
			<table style="width: 100%;">
			   <tr>
			   <td colspan="4" style="text-align: center; height: 20px; font-size: 15px; font-weight: bold;">
		        <button id="entry"  class="button_b">确&nbsp;定</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		        <button id="center" class="button_b" >取&nbsp;消</button>
		       </td>
		      </tr>
			</table>
		</form>
	</body>
</html>
